package com.tj.collection.controller.admin.response;

import com.fqgj.common.api.Page;
import com.fqgj.common.api.ResponseData;
import com.fqgj.common.utils.CollectionUtils;
import com.tj.collection.db.domain.Role;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: sm
 * Date: 2016/11/18
 * Time: 上午11:34
 */
public class RoleListResponse implements ResponseData {
    private Page page;

    private List<Item> list = new ArrayList<>();

    public RoleListResponse(List<Role> roleEntityList, Page page) {
        this.page = page;

        if (CollectionUtils.isNotEmpty(roleEntityList)) {
            for (Role role : roleEntityList) {
                Item item = new Item()
                        .setId(role.getRoleId())
                        .setName(role.getName())
                        .setDescription(role.getDescription());
                list.add(item);
            }
        }
    }

    private class Item {
        private Long id;
        private String name;
        private String description;

        public Long getId() {
            return id;
        }

        public Item setId(Long id) {
            this.id = id;
            return this;
        }

        public String getName() {
            return name;
        }

        public Item setName(String name) {
            this.name = name;
            return this;
        }

        public String getDescription() {
            return description;
        }

        public Item setDescription(String description) {
            this.description = description;
            return this;
        }
    }
}
